﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cloo;

namespace OpenCLTester
{
    class Program
    {
        static void Main(string[] args)
        {
            ComputePlatform plattform = ComputePlatform.Platforms[0];
            ComputeDevice device = plattform.Devices[0];

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("System");
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine(" OpenCL Version: " + device.Version);
            Console.WriteLine(" Plattform:   " + plattform.Name);

            Console.WriteLine("");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Device");
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine(" Device:  " + device.Name);
            Console.WriteLine(" Type: " + device.Type.ToString());
            Console.WriteLine(" Driverversion: " + device.DriverVersion);
            Console.WriteLine(" Available: " + device.Available);

            Console.WriteLine("");
            Console.ForegroundColor=ConsoleColor.White;
            Console.WriteLine("Processors"); 
            Console.ForegroundColor=ConsoleColor.Gray;

            Console.WriteLine(" Compute Units: " + device.MaxComputeUnits + " streaming multiprocessors");
            Console.WriteLine(" Frequency: " + device.MaxClockFrequency + " MHz");
            Console.WriteLine(" Max Workitems: " + device.MaxWorkGroupSize + " streaming processors (" + (device.MaxWorkGroupSize / device.MaxComputeUnits) + " each SM)");
            Console.WriteLine(" Max Dimensions: " + device.MaxWorkItemDimensions);

            Console.WriteLine("");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Memory");
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine(" Memory: " + device.GlobalMemorySize + " bytes (" + (device.GlobalMemorySize / 1024 / 1024) + " mb)");
            Console.WriteLine(" GCache: " + device.GlobalMemoryCacheSize + " bytes");
            Console.WriteLine(" CCache: " + device.MaxConstantBufferSize + " bytes");
            Console.WriteLine(" Register: " + device.LocalMemorySize + " bytes");

            Console.WriteLine("");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Adressing");
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine(" Adressing bits: " + device.AddressBits + " Bit");
            Console.WriteLine(" Endian: " + (device.EndianLittle ? "Little" : "Big"));

            Console.ReadKey();
        }
    }
}
